home *** CD-ROM | disk | FTP | other *** search
- Path: news.corp.sgi.com!user
- From: sandvik@sgi.com (Kent Sandvik)
- Newsgroups: comp.lang.smalltalk,comp.object,comp.lang.c++,comp.lang.java
- Subject: Re: The Good, the Bad, the Ugly, and the Wicked ...
- Date: Thu, 28 Mar 1996 10:28:51 -0800
- Organization: Silicon Graphics, Inc.
- Message-ID: <AD801A639668229B48@mac-sandvik.engr.sgi.com>
- References: <31570B8E.5A12@vmark.com> <31586721.1750@mobius.net> <4jbk0m$jt9@news4.digex.net> <AD7EDB45966858C12@mac-sandvik.engr.sgi.com> <4jecok$a01@news4.digex.net>
- NNTP-Posting-Host: mac-sandvik.engr.sgi.com
-
- In article <4jecok$a01@news4.digex.net>,
- ell@access2.digex.net (Ell) wrote:
-
- >Kent Sandvik (sandvik@sgi.com) wrote:
- >: >C++ very much has dynamic binding; lookup virtual functions.
- >
- >: It depends how you defined dynamic binding, could you send messages to
- >: arbitrary methods in C++ during runtime (or java, by the way)?
- >
- >In C++ the specific function being invoked is determined by the specific
-
- >object assigned to a pointer at any one time. The pointer has a static
- >type, yet it can invoke functions of other types during run-time.
-
- Yes, but I was hinting at the SmallTalk/Objective-C et rest feature of
- calling methods, and if this method is not found, the system responds
- anyway. The static language approach is to let the compiler flag such
- cases, while in fully dynamic languages anything could be called, whether
- it's defined or not. The first
- approach is oh so useful with very flexible and ever changing user
- interface
- frameworks, for example.
-
- The vtable approach works in the context of staticly defining the possible
- outcomes. It has drawbacks as well, like the dreadful 'fragile base class'
- problem that haunts most systems where someone wants to ship the base class
- in a dynamic shared library, for example. Someone subclasses it, and if now
- the vendor ships an alternate version, the vtable offsets differ, so that
- the sub-classed system won't work any longer.
-
- Not to speak of the headaches creating ROM-only code using vtables.
-
- Cheers, Kent
-
-
-
-
- Kent Sandvik, Silicon Graphics, Inc. Member of Technical Staff
- Email: sandvik@sgi.com Phone: +1 415 933-6417
- http://reality.sgi.com/sandvik/ (sgi http:/kent.engr/)
- "May all developers be happy."
-